/* 
 * 
 * Created on 14 Oct 2011 by simonk
 * 
 * Copyright: Multicom Products Ltd. 2011 Bristol, England
 */
package gui;

import gui.main.MainPanelGUIView;

import java.awt.Dimension;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Insets;
import java.awt.Toolkit;
import java.util.HashMap;
import java.util.Map;

import javax.swing.JFileChooser;
import javax.swing.JFrame;

/**
 *
 * @author simonk
 */
public class GUIUtils {
	public static MainPanelGUIView MainPanel = null;
    public static JFileChooser fileChooser = new JFileChooser();
	
	public static void centrePositionOnScreen(JFrame frm) {
		Toolkit kit = frm.getToolkit();
		GraphicsEnvironment ge = GraphicsEnvironment
				.getLocalGraphicsEnvironment();
		GraphicsDevice[] gs = ge.getScreenDevices();
		Insets in = kit.getScreenInsets(gs[0].getDefaultConfiguration());

		Dimension d = kit.getScreenSize();
		int max_width = (d.width - in.left - in.right);
		int max_height = (d.height - in.top - in.bottom);
		// frm.setSize(Math.min(max_width, 850), Math.min(max_height,
		// 550));//whatever size you want but smaller the insets
		frm.setLocation((int) (max_width - frm.getWidth()) / 2,
				(int) (max_height - frm.getHeight()) / 2);
	}
}
